package com.zhaopin.leetcode;

import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

/**
 * @author Administrator
 * @create 2020-07-23 16:38
 */
public class Three {


    public static void main(String[] args) {
        System.out.println(lengthOfLongestSubstring("abceedfgg"));
    }

    public static int lengthOfLongestSubstring(String s) {
        if (s.length() > 0) {
            String[] cAttr = s.split("");
            List<String> list = new ArrayList<>();
            StringBuilder strBuilder = new StringBuilder();
            for (int i = 0; i < cAttr.length; i++) {
                //i为每个单值的下标
                String a = cAttr[i];
                if (strBuilder.indexOf(a) == -1) {
                    strBuilder.append(a);
                } else {
                    break;
                }

            }
            System.out.println(strBuilder.toString());

        }

        return 0;
    }

}
